package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateParkingLotManageInfoDTO;
import com.itlong.cloud.POJO.DTO.operate.OperateParkingLotManagePageDTO;
import com.itlong.cloud.POJO.VO.operate.OperateParkingLotManageInfoVO;
import com.itlong.cloud.operate.service.IOperateParkingLotManageService;
import com.itlong.cloud.project.operate.IOperateParkingLotManageServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <desc>
 *   运营-人脸管理-应用管理接口暴露实现。
 * <desc/>
 *
 * @createDate 2018-05-03.
 */
@RestController
public class OperateParkingLotManageServiceResource implements IOperateParkingLotManageServiceClient {

    @Autowired
    IOperateParkingLotManageService iOperateParkingLotManageService;

    /**
     * <desc>
     *      停车场信息分页查询
     * <desc/>
     *
     * @param  operateParkingLotManagePageDTO 分页查询参数
     * @return
     * @author Qiang.S
     * @createDate 2018-11-05
     */
    @Override
    @RequestMapping(path = "/operate/parking/parkingLotManage/getParkingLotPage", method = {RequestMethod.POST})
    public Page<OperateParkingLotManageInfoVO> getParkingLotPage(@RequestBody OperateParkingLotManagePageDTO operateParkingLotManagePageDTO) throws Exception{
        return iOperateParkingLotManageService.getParkingLotPage(operateParkingLotManagePageDTO);
    }

    /**
     * <desc>
     *      新增停车场
     * <desc/>
     *
     * @param operateParkingLotManageInfoDTO 停车场信息
     * @return
     * @author Qiang.S
     * @createDate 2018-11-05
     */
    @Override
    @RequestMapping(path = "/operate/parking/parkingLotManage/save", method = {RequestMethod.POST})
    public Integer save(@RequestBody OperateParkingLotManageInfoDTO operateParkingLotManageInfoDTO) throws Exception{
        return iOperateParkingLotManageService.save(operateParkingLotManageInfoDTO);
    }

    /**
     * <desc>
     *      更新停车场
     * <desc/>
     *
     * @param operateParkingLotManageInfoDTO 停车场信息
     * @return
     * @author Qiang.S
     * @createDate 2018-11-05
     */
    @Override
    @RequestMapping(path = "/operate/parking/parkingLotManage/update", method = {RequestMethod.POST})
    public Integer update(@RequestBody OperateParkingLotManageInfoDTO operateParkingLotManageInfoDTO) throws Exception{
        return iOperateParkingLotManageService.update(operateParkingLotManageInfoDTO);
    }

    /**
     * <desc>
     *      判断停车场是否被使用
     * <desc/>
     *
     * @param parkId 停车场编号
     * @return
     * @author Qiang.S
     * @createDate 2018-11-05
     */
    @Override
    @RequestMapping(path = "/operate/parking/parkingLotManage/checkParkingLot", method = {RequestMethod.POST})
    public Integer checkParkingLot(@RequestParam("parkId")String parkId) throws Exception{
        return iOperateParkingLotManageService.checkParkingLot(parkId);
    }

    /**
     * <desc>
     *      判断该项目是否已有停车场
     * <desc/>
     *
     * @param projectId 项目编号
     * @return
     * @author Qiang.S
     * @createDate 2018-11-05
     */
    @Override
    @RequestMapping(path = "/operate/parking/parkingLotManage/checkParkingRepeat", method = {RequestMethod.POST})
    public Integer checkParkingRepeat(@RequestParam("projectId")String projectId) throws Exception{
        return iOperateParkingLotManageService.checkParkingRepeat(projectId);
    }

    /**
     * <desc>
     *      删除停车场
     * <desc/>
     *
     * @param parkId 停车场编号
     * @return
     * @author Qiang.S
     * @createDate 2018-11-05
     */
    @Override
    @RequestMapping(path = "/operate/parking/parkingLotManage/delete", method = {RequestMethod.POST})
    public Integer delete(@RequestParam("parkId")String parkId) throws Exception{
        return iOperateParkingLotManageService.delete(parkId);
    }

    /**
     * <desc>
     *      根据停车场编号获取停车场信息
     * <desc/>
     *
     * @param parkId 停车场编号
     * @return
     * @author Qiang.S
     * @createDate 2018-11-05
     */
    @Override
    @RequestMapping(path = "/operate/parking/parkingLotManage/getDetail", method = {RequestMethod.POST})
    public OperateParkingLotManageInfoVO getDetail(@RequestParam("parkId") String parkId) throws Exception{
        return iOperateParkingLotManageService.getDetail(parkId);
    }

}
